package com.example.et.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.et.entity.Gong;
import com.example.et.entity.Mechanism;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

@Service
public interface GongMapper extends BaseMapper<Gong> {

    @Insert("insert into info_gong (id,che_id,name,administer,station,gangmaster,tgangmaster,leader) values(#{id},#{cheid},#{gong},#{administer},#{station},#{gangmaster},#{tgangmaster},#{leader})")
    int InsertGong(@Param("id") int id, @Param("cheid") int cheid, @Param("gong") String gong, @Param("administer") String administer, @Param("station") String station, @Param("gangmaster") String gangmaster, @Param("tgangmaster") String tgangmaster, @Param("leader") String leader);

    @Insert("insert into info_gong (id,che_id,name) values(#{id},#{cheid},#{gong})")
    int InsertGong(@Param("id") int id, @Param("cheid") int cheid, @Param("gong") String gong);

    @Update("UPDATE info_gong set che_id = #{cheid},name = #{gong}, administer = #{administer} , station = #{station}, gangmaster = #{gangmaster}, tgangmaster = #{tgangmaster}, leader = #{leader} where id = #{id}" )
    int UpdateGong(@Param("id") int id,@Param("cheid") int cheid,@Param("gong") String gong,@Param("administer") String administer,@Param("station") String station, @Param("gangmaster") String gangmaster,@Param("tgangmaster") String tgangmaster,@Param("leader") String leader);

    @Delete("Delete from info_gong where id = #{id}")
    int DeleteGong(@Param("id") int id);
}
